-
Notifications
You must be signed in to change notification settings - Fork 195
Don't lint expression(paste(., sep = "")) in paste_linter #2955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2955 +/- ##
=======================================
Coverage 99.24% 99.24%
=======================================
Files 128 128
Lines 7291 7307 +16
=======================================
+ Hits 7236 7252 +16
Misses 55 55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I've changed the implementation so that we report a different message if |
R/paste_linter.R
Outdated
| #' ) | ||
| #' | ||
| #' lint( | ||
| #' text = 'expression(paste("a", "b", sep = ""))', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be in the "will produce lints" section; our approach generally is to "pair" linting expressions with their "clean" equivalents across the "top" and bottom (under "okay") parts of the documentation.
(it's a bit messy for this file in particular because paste_linter() does a lot)
|
|
||
| if (!allow_empty_sep) { | ||
| ## check if we are inside an expression() | ||
| expression_paste_sep_expr <- xml_find_all(paste_calls, expression_paste_sep_xpath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks off -- what happens for something like this?
c(
expression(paste(x, y, sep="")),
paste(x, y, sep=""),
expression(paste(a, b, sep="")),
paste(a, b, sep="")
)(generally xml_find_all() is 🚩 to me since it is not 1:1 -- for y = xml_find_all(x, ...), y[i] cannot predictably be associated with x[i] -- usually within linters we want to use xml_find_first())
Fixes #2945.